home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac: Not for Sale / Another.not.for.sale (Australia).iso / fade into you / being there / Internet Accounting / Measuring Use - Ray / ray.txt < prev   
Text File  |  1994-05-16  |  37KB  |  817 lines

  1.    Measuring Network Utilisation at the University of Melbourne
  2.    [ascii version]
  3.  
  4.    Douglas Ray
  5.    doug@unimelb.edu.au
  6.    Information Technology Services
  7.    University of Melbourne
  8.  
  9.    Copyright 1993 University of Melbourne
  10.  
  11. --------------------------------------------------------------------------
  12.     0    context
  13.     1    task
  14.     2    network topology
  15.     3    sources of info
  16.     4    algorithm and constraints
  17.     5    NNStat and constraints
  18.     6    implementation architecture
  19.     7    performance considerations
  20.     8    ancillary info
  21.     9    conclusions
  22.  
  23. --------------------------------------------------------------------------
  24.     0    context
  25.  
  26. This paper explores a specific project in network usage monitoring,
  27. currently in use at the University of Melbourne.   The project was
  28. partly prompted by the perception that at some stage charging for
  29. external network traffic may become necessary within the University.
  30.  
  31. "Usage" is a fiddly thing to define, because unless you do protocol
  32. emulation on every connection you can't always determine which side
  33. of a connection initiated a data transfer.   This paper does not
  34. address that problem.
  35.  
  36. To date, the possible mode of charge has been assumed to be a measure
  37. of volume usage, possibly weighted by type-of-service.   Byte and
  38. packet measures have been derived, and per-service figures are kept.
  39.  
  40. Within this limited frame there are many possible strategies.   Links
  41. have fixed bandwidth, routers have upper limits on packet switching, so
  42. depending on the degree of saturation, and whether a route is saturated
  43. at link or at gateway, different weightings of byte and packet measures
  44. may be applicable - *eg*, straight byte-based accounting for saturated
  45. links, and a combination of byte and packet accounting for
  46. non-saturated links and router bottlenecks.
  47.  
  48. However, this begs the question of what is trying to be achieved in
  49. charging.  The rationale behind the above example is that charges
  50. should directly reflect the cost of the infrastructure (links and
  51. routers) being used.  Further, the implication is that charging is a
  52. means of recouping costs.  This ignores the utility of charging in
  53. managing usage patterns.
  54.  
  55. If you're trying to curtail usage of saturated links, there's not much
  56. point putting a financial premium on their use unless the person being
  57. charged knows when they are suffering the premium.   To effect such
  58. behaviour it is more effective - not to mention much simpler - to
  59. specify peak usage periods, and charge a premium on usage in those
  60. periods.
  61.  
  62. These, and other strategies, and references, can be found in Roger
  63. Clarke's paper for this conference.   My concern is not so much the
  64. charging strategy as the method of measuring usage.   The foregoing
  65. discussion serves to emphasise that "usage" has as many meanings as one
  66. chooses to define.   The definition we're after is the one which
  67. saves us money.
  68.  
  69. --------------------------------------------------------------------------
  70.     1    task
  71.  
  72. The task I was presented with was to measure and characterise types of
  73. traffic between parts of the University and the rest of Victoria, greater
  74. Australia, and overseas.   (By "characterisation" of traffic I mean
  75. measuring various types of services used - telnet, mail, ftp, etc.)
  76.  
  77. It quickly became apparent that it would be useful to log a fourth class
  78. separately: traffic with the central AARNet servers.
  79.  
  80. Only IP traffic is considered.   This forms the bulk of traffic exiting
  81. the campus network.
  82.  
  83. "Parts of the University" was clarified to be subnets.   This may need to
  84. be refined in the light of possible charging applications.   If one
  85. assumed we wanted to generate bills at a departmental or faculty level
  86. there are a few problems we must solve.
  87.  
  88. A) Departments with mixed subnets
  89.  
  90. This is simple - add the subnets - and we probably need to do this
  91. anyway.   However, there is a substantial chunk of work in adding the
  92. further level of abstraction, department, on top of the existing
  93. subnet-based processing.
  94.  
  95. B) Subnets with mixed departments
  96.  
  97. This is the killer.   The best solution is not to mix departments on a
  98. subnet, but given our current subnet usage that would be impractical.
  99. Also, there are some departments that naturally have hosts dotted all
  100. over campus; eg, the library.  All solutions, other than segregation of
  101. departments at the subnet level, require changing the granularity of
  102. local peer from subnet to host, and collating the host info by
  103. department.   (For a note on the practicality of this, see section
  104. 7).   Even if we presume that performance limits would allow this, we
  105. also need procedures which enable automatic updates of our stats
  106. monitor config whenever new hosts appear, move between departments, or
  107. when departments move between subnets.
  108.  
  109. One solution is to collate IP's by DNS zone name.   This presumes that
  110. the zone names in the DNS adequately reflect departmental
  111. structure for billing purposes.
  112.  
  113. If they don't, then a separate table of IP number/department pairs (or
  114. hostname/department pairs, with the IP number being found by DNS query).
  115. This assumes that the list will be maintained - which requires extra
  116. work on updates - or that the DNS files will be automatically
  117. regenerated from the list.   It also assumes that those departments
  118. running their own nameservers remember to forward information of new
  119. hosts to us... information for which they will be billed.
  120.  
  121. C) Subnets with shared resources
  122.  
  123. As an example, we have various hosts in lecture theatres, for which
  124. someone would have to work out a billing system.
  125.  
  126. --------------------------------------------------------------------------
  127.     2    network topology
  128.  
  129. We measure this traffic on the following network.
  130.  
  131.     [FIGURE]
  132.  
  133. The key points of this topology are as follows.   The AARNet spine has
  134.     * servers
  135.     * a link to Internet via the USA
  136.     * links to other states via the national router
  137.     * links to Victorian institutions via the Victorian router
  138. One of these latter links connects to the University of Melbourne's
  139. ethernet spine.   The UoM ether spine supports two routers making
  140. redundant connections to the main FDDI ring around campus.   (There are
  141. a further 6 cisco routers on the FDDI ring.)
  142.  
  143. The University is primarily a class B network using a subnet mask of
  144. 255.255.255.0.   Only a handful of subnet numbers are not in use.
  145. Variable length subnet masks have recently been enabled, but the
  146. implications of this for our stats reporting methodology are not
  147. discussed here.
  148.  
  149. --------------------------------------------------------------------------
  150.     3    sources of info (on campus)
  151.  
  152.   3.1.1 cisco routers
  153.   3.1.2 stats servers
  154.   3.1.2.1 departmental stats servers
  155.   3.1.2.2 central stats server
  156.   3.2 geographic info
  157.  
  158.   3.1.1 cisco routers
  159. The cisco routers can be configured for IP logging.   This gives IP source
  160. and destination pairs, with packet and byte counts.   The drawbacks of
  161. this approach are -
  162.     * can't distinguish type-of-service.
  163.         (for this we'd need the port numbers)
  164.     * no control of granularity: must collate info for each host-host
  165.         pair (not to mention download the info across the network)
  166.     * load on the routers
  167.         (IP logging imposes a substantial CPU overhead on ciscos)
  168.     * doesn't give geographic location of peer.
  169.  
  170.   3.1.2 stats servers
  171. Dedicated stats servers have several advantages over router accounting.
  172. Using generic packet filtering, we can select by
  173.     * fields in the ethernet header
  174.     * fields in the IP header
  175.     * derived info ("virtual fields": eg, network and subnet)
  176. This makes it easy to differentiate type-of-service.  Dedicated stats
  177. servers impose little or no performance overhead on network load.
  178. (We find this functionality in the NSFnet software package, NNStat,
  179. which is used on the AARNet stats server *vovo* and on our stats
  180. server.)
  181.  
  182. If we use stats servers, where do we put them?
  183.  
  184.   3.1.2.1 departmental stats servers
  185. A dedicated stats server on each subnet would have the advantage of
  186. measuring real traffic on the subnets, rather than just traffic
  187. crossing a cisco interface.
  188.  
  189. However, though this could be useful for maintenance and load
  190. prediction, it is not part of the task under discussion.   It is also
  191. particularly expensive, both in equipment and configuration time.
  192.  
  193.   3.1.2.2 central stats server
  194. A single stats server on the UoM ether spine would see each packet entering
  195. or exiting the University.   Results can be processed locally on the
  196. server rather than being shipped across the network, and the presence of
  197. the server doesn't affect network performance.   This is the approach
  198. we've taken.
  199.  
  200.   3.2 geographic info
  201. Remember, our task is to separate Victorian, Australian and international
  202. traffic.   How do we get the geographic location of the peer?
  203.  
  204. Traffic crossing the UoM ether spine will have an ethernet address (either
  205. source or destination) of the victorian gateway.   This differentiates the
  206. traffic we want from any other stuff, but still doesn't give us the geographic
  207. info we need.
  208.  
  209. The only other source of information at the UoM ether spine is the IP
  210. address of the peer.    That means we need a list of network numbers
  211. and their geographic location.     What range of network numbers do we
  212. wish to cover?  We don't need (or want) every network in the world.
  213. If we had, separately, all Victorian networks and all other Australian
  214. networks, then anything else can be assumed to be overseas.   (But all
  215. we really require are those Victorian and Australian nets that talk
  216. with us.)
  217.  
  218. We might consider traceroute (but not for long :).  Even with a maximum
  219. hop count of two, using traceroute to determine the location of IP
  220. numbers would be an excellent way of consuming system resources.   At
  221. one extreme one traces every address not currently known, recording
  222. Victorian or Australian networks in lists - then each overseas address
  223. generates a trace whenever it occurs.    T'other extreme, we maintain a
  224. list of overseas addresses as well... but that list would get rather
  225. large.   Okay, well, we can *cache* the overseas addresses... but one
  226. starts to sense it could be worth looking for a simpler solution.
  227.  
  228. There's a file which contains details of all Australian IP networks, on
  229. munnari.oz.au: "netinfo/status".   Unfortunately, although the
  230. network numbers and network names are kept up to date, the geographic
  231. information is not complete.
  232.  
  233. Traffic crossing the AARNet spine has an ethernet peer address of the
  234. Victorian gateway, the national gateway, or the usa gateway (for
  235. simplicity we'll ignore the fiji gateway).   This is where we can
  236. distinguish our target geographic classes.   Luckily, the AARNet stats
  237. server (vovo) already does this, so we can get lists of Australian and
  238. Victorian IP networks from there.   We download the files listing
  239. Victorian networks and their Australian network connection peers.
  240. This is an adequate approximation of the required "Victorian and
  241. Australian nets that talk with us", ignoring any Victorian nets that
  242. talk exclusively with us.
  243.  
  244. --------------------------------------------------------------------------
  245.     4    algorithm and constraints
  246.  
  247.   4.1 algorithm
  248.   4.2 constraints of the algorithm
  249.  
  250.   4.1 algorithm
  251. Here we discuss the algorithm used for sorting and collating the traffic.
  252.  
  253. As mentioned above, the common factor in all traffic we're interested in
  254. is that, when crossing the UoM ether spine, it has either a source or
  255. destination ethernet address of the victorian gateway.   This gives us
  256. the outer tests of our algorithm.   Given the lists of network numbers
  257. we can easily derive the basic structure, which uses eight sets of tests
  258. to record traffic in and out of each of our four target locations:
  259.  
  260.     if ether source = vic.gw
  261.     then {
  262.         if IP source network is in VICnets
  263.             record in incoming-traffic-from-vic
  264.         else if IP source subnet is in AARNspine
  265.             record in incoming-traffic-from-aarn
  266.         else if IP source network is in AUSnets
  267.             record in incoming-traffic-from-aus
  268.         else
  269.             record in incoming-traffic-from-os
  270.     }
  271.     else if ether destination = vic.gw
  272.     then {
  273.         if IP destination network is in VICnets
  274.             record in outgoing-traffic-to-vic
  275.         else if IP destination subnet is in AARNspine
  276.             record in outgoing-traffic-to-aarn
  277.         else if IP destination network is in AUSnets
  278.             record in outgoing-traffic-to-aus
  279.         else
  280.             record in outgoing-traffic-to-os
  281.     }
  282.  
  283. From here, the pseudocode "record" must be expanded to a block of tests
  284. which logs at the particular level of granularity required.   (This
  285. will be discussed later: see section 6.2.1.)   In our context this means a
  286. series of tests to distinguish port information, and special tests for
  287. particular servers and subnets.
  288.  
  289.   4.2 constraints of the algorithm
  290. Traffic with addresses not registered in our lists of Victorian and
  291. Australian networks will be wrongly attributed to overseas traffic.
  292. Also, networks are dynamic.   More arrive continually, on something
  293. between a daily and weekly basis.  To address these points we need
  294. timely updates of the network lists.
  295.  
  296. Unavoidably, we also need to rebuild the config of our network
  297. monitoring software on a daily basis, to include updated network lists
  298. in an automated and robust fashion.   (Or, rather, we need to check
  299. to see if it needs rebuilding.)
  300.  
  301. While doing all this it would be prudent to log changes of config with
  302. detail sufficient that we can reverse any problems.   If someone
  303. broadcasts a bogus net we don't want it on our server forever.
  304.  
  305. --------------------------------------------------------------------------
  306.     5 NNStat
  307.  
  308.   5.1 Intro
  309.   5.2 Constraints of NNStat
  310.   5.2.1 single statspy per server
  311.   5.2.2 polling rewrite bug
  312.   5.2.3 NNStat config limits
  313.   5.2.4 subnet bug
  314.   5.2.5 "select" bug?
  315.   5.2.6 separate configs for statspy and collect
  316.  
  317.   5.1 Intro
  318. These comments apply to version 3.2 of NNStat, which was the current
  319. version at the start of 1993.   A beta release of version 3.3 has been
  320. recently released.
  321.  
  322. NNStat is distributed as source code for Sun and DECstation
  323. platforms.   It relies on a permissive mode network interface, using
  324. the NIT device on SunOS and the packetfilter option on ULTRIX.   Two
  325. daemons do most of the work.   Statspy, the monitor process, scans
  326. packets available on the network interface and matches them against a
  327. pattern config to control various counting operations.   Collect, the
  328. logger process, periodically interrogates the statspy monitor and logs
  329. the information in files.   A third tool, rspy, allows interactive
  330. query and control of the statspy monitor.   (Rspy is only used for
  331. diagnostic purposes in our system.)
  332.  
  333. Counting operations are object-based, and the collect logger can be
  334. told to look for all objects or given subsets of objects.   Checkpoint
  335. and logging periods are constant for a given collect process;  using
  336. several collect processes, one can log various objects at different
  337. temporal resolutions.
  338.  
  339. Three periods - the polling, checkpoint and clear intervals - can be
  340. set independantly for each collect process.   At each polling period,
  341. collect gathers totals for its chosen objects from statspy, and logs
  342. them to files.   Subsequent polls overwrite the previously logged
  343. record, until the checkpoint period expires, at which time the next
  344. record to be logged is appended to the file.   Totals between
  345. checkpoints (and polls) are cummulative until the clear period expires,
  346. at which point all counters are reset.
  347.  
  348.   5.2 Constraints of NNStat
  349. A number of constraints are imposed by the current implementation of NNStat.
  350.  
  351.   5.2.1 single statspy per server
  352. One can only have one monitor process - and one active config - per server.
  353. Because of this we can't test configs on the production server without
  354. interrupting stats collection.   We either suffer downtime or use a
  355. developmental server.
  356.  
  357.   5.2.2 polling rewrite bug
  358. The method NNStat uses for the collect processes to log info to files
  359. is buggy:  logs sometimes acquire inter-record garbage.   Because of
  360. this the log files must be parsed with some non-intuitive tests during
  361. postprocessing.
  362.  
  363.   5.2.3 NNStat config limits
  364. There are various fixed limits in the NNStat code, some of which aren't
  365. documented.  These limits can be changed by recompiling the source, but
  366. any given config must work within the limits of the currently installed
  367. executables.   The limits which we know of are:
  368.     maximum number of objects for collector
  369.     maximum number of cases in a "select" statement
  370.     maximum number of parameters for object class definitions
  371. These limits have all been raised in our installation.  Some config
  372. overflow errors are silently ignored, some trigger core dumps - either
  373. way, we must check that they aren't exceeded when building the config.
  374.  
  375.   5.2.4 subnet bug
  376. There is a bug in 3.2 preventing access to subnet information on
  377. little-endian architectures (eg, DECstation).   A patch for this was
  378. found by Gavin Stone-Tolcher (UQ).
  379.  
  380.   5.2.5 "select" bug?
  381. There may be a bug in the number of cases recognised by the "select"
  382. statement - either that or a confusion of datatypes has led to only
  383. half the specified maximum being useable.   This will be confirmed when
  384. our developmental server is configured.
  385.  
  386.   5.2.6 separate configs for statspy and collect
  387. The monitor process and logging processes look at separate config files
  388. for essentially the same information.   This marginally complicates building
  389. the configuration.
  390.  
  391.  
  392. --------------------------------------------------------------------------
  393.     6    implementation architecture
  394.  
  395.   6.1 Server Platform
  396.   6.2 Software
  397.   6.2.1 Config Builder
  398.   6.2.2 NNStat Traffic Logger
  399.   6.2.3 Postprocessing
  400.  
  401.   6.1 Server Platform
  402. The production server, noc, is a DECstation 5000/250 with 64M ram and
  403. 2G disk, running ULTRIX 4.3.   (This is not an endorsement of DEC.)
  404. While noc was being coaxed to sporadic life, the project was supported
  405. on a Solbourne S4000 with 40M ram and 1G disk, running OS/MP 4.1a.3
  406. (licensed SunOS, ~4.1.2).
  407.  
  408.   6.2 Software
  409. The present system is cobbled together from scripts.   With marginal
  410. editing of reality, it can be divided into the four functional units
  411. shown in figure XXXX.   (Most of the NNStat traffic logger and a good
  412. portion of the postprocessing scripts were donated by Robert Elz, from
  413. his work on the AARNet stats server.)
  414.  
  415.     [FIGURE]
  416.  
  417. My aim is to automate the procedure as far as possible.   Human
  418. intervention should only be required for qualitative evaluations,
  419. during the report generation phase.   Currently, both the config
  420. creation and traffic logging run untended.   Postprocessing is still
  421. initiated manually, pending rationalisation of error reporting and
  422. satisfactory error handling.   Report generation facilities are
  423. meagre.
  424.  
  425.   6.2.1 Config Builder
  426. The config builder updates the NNStat config with new Victorian and
  427. other Australian network numbers.   It sifts through the network lists
  428. obtained from vovo, and when new numbers are found, incorporates them
  429. into the config.   It maintains version details for the config, logs
  430. which vovo file the new numbers came from, and logs when a new config
  431. is installed.   Figure XXXX gives a (rather simplified) view of the
  432. process.
  433.  
  434. There are three main parts in the code.   First there's a module
  435. that manages the network numbers.   This is called nightly from cron.
  436. When new numbers are found, it calls the config builder module, which
  437. reassembles the NNStat config from various schemas.   Finally, if the
  438. config was rebuilt successfuly successful, the config builder calls a
  439. module which installs the config.
  440.  
  441.     [FIGURE]
  442.  
  443. Integrated within this code are checks to ensure that a new config
  444. doesn't exceed NNStat's limits (insofar as these are known).   If these
  445. are exceeded, the new config will not be installed, future config
  446. updates will be suspended, and mail sent to the administrator.   Before
  447. this happens, when the config expands beyond certain thresholds,
  448. warning mail is sent to the administrator. This will allow a new set of
  449. executables to be compiled and installed before config updates are
  450. interrupted.
  451.  
  452. The main schema for the config implements the algorithm discussed
  453. earlier (see section 4.1).   The blocks of tests referred to record
  454. subnet and type-of-service, and, for the most part, have a common
  455. structure.  Accordingly, we generate all eight blocks by expansion of a
  456. single schema of subnet tests - this simplifies modifications if we
  457. need to change the level of detail of information logged.
  458.  
  459. The block which records traffic into the University from Australian
  460. networks has the following form.   First, the total for all incoming
  461. ethernet traffic is logged.  Traffic destined for hosts on the UoM
  462. ether spine (excluding the fddi routers) is recorded, and then we deal
  463. with traffic heading for the fddi ring.   For traffic bound for the
  464. FDDI ring, exceptions are handled - munnari.   We keep track of
  465. munnari's traffic because it supplies national services.   All IP
  466. traffic is logged, and then, separately, TCP traffic and UDP traffic.
  467. Source and destination ports are logged separately for TCP and UDP.
  468. Having dealt with munnari, we handle the rest of the University
  469. similarly, logging first IP traffic totals, then subtotals for TCP
  470. matched on source port, TCP matched on destination port, UDP matched on
  471. source port and UDP matched on destination port.   The destination
  472. subnet is recorded, to give some idea of which parts of the University
  473. are in communication.
  474.  
  475.  
  476.     # traffic into campus from ausnets
  477.     record destination-subnet
  478.     select Ether.destination {
  479.       case (  HOSTS-ON-UoM-ETHER-SPINE )
  480.     record Ether.destination
  481.       case ( "rb1.rtr", "rb2.rtr" ): {
  482.      # to campus on FDDI ring:
  483.         if IP.destination is munnari {
  484.           record IP.destination
  485.           if TCP.destinationport is in TCP-PORTS-LIST
  486.             record TCP.destinationport
  487.           if TCP.sourceport is in TCP-PORTS-LIST
  488.             record TCP.sourceport
  489.           if UDP.destinationport is in UDP-PORTS-LIST
  490.             record UDP.destinationport
  491.           if UDP.sourceport is in UDP-PORTS-LIST
  492.             record UDP.sourceport
  493.         }
  494.  
  495.         # All subnets (including munnari traffic):
  496.         record IP.destination-subnet
  497.         if TCP.destinationport is TCP-PORTS-LIST
  498.           record TCP.destinationport, IP.destination-subnet
  499.         if TCP.sourceport is TCP-PORTS-LIST
  500.           record TCP.sourceport, IP.destination-subnet
  501.         if UDP.destinationport is UDP-PORTS-LIST
  502.           record UDP.destinationport, IP.destination-subnet
  503.         if UDP.sourceport is UDP-PORTS-LIST
  504.           record UDP.sourceport, IP.destination-subnet
  505.       }
  506.       default : {   # shouldn't be anything in here.
  507.         record Ether.destination, Ether.source
  508.         record IP.destination, IP.source
  509.       }
  510.     }                         # end select Ether.dst
  511.  
  512.   6.2.2 NNStat Traffic Logger
  513. The traffic logger is shown (almost verbatim) in Fig. XXXX.
  514. The system is started at boot time from rc.local, and restarted at
  515. midnight from cron.   There is a script to control starting the NNStat
  516. processes (restart.noc) and another which stops them (stop.noc).
  517.  
  518.     [FIGURE]
  519.  
  520. The collect processes log information in files named after the object being
  521. logged, one file per object, and given a suffix indicating the time at
  522. which the collect process was invoked.   The timestamp causes the
  523. collect processes to log to different files (unless processes are
  524. started within the same minute).
  525.  
  526. We choose to stop and restart the statspy and collect processes daily.
  527. This means that we get a new set of log files each day, which
  528. simplifies expunging corrupted logs from the data.   It also makes it
  529. easy to install a new config when one is required.   (We could manually
  530. update the runtime config on statspy via rspy, but as we have to
  531. generate the new config anyway, and we have an excuse for stopping the
  532. logging, there would be no point in such sophistication.)
  533.  
  534. Process IDs are recorded and timestamped whenever the processes are
  535. stopped or restarted, and a comment can be automatically inserted in
  536. the log when the scripts are run manually.   When statspy is started
  537. it gives a commentary on what it thinks of your config.   This
  538. diagnostic message is superficially parsed by the start-up script
  539. (restart.noc) to detect key words ("error", "warning"), and when
  540. problems are detected mail is sent to the administrator.
  541.  
  542. One action not represented on the diagram is the weekly transfer of the
  543. traffic logs.   Once a week, between stopping and restarting the NNStat
  544. processes, the *daily* script renames the current logging directory
  545. with a timestamp and recreates the logging directory.   (Our reports are
  546. based on weekly aggregates).
  547.  
  548.  
  549.   6.2.3 Postprocessing
  550.  
  551.   5.2.3.1 Input
  552.   5.2.3.2 Output
  553.   5.2.3.3 Reconcilliation
  554.   5.2.3.4 Geographic totals pipeline
  555.   5.2.3.5 Type-of-Service totals pipeline
  556.  
  557. Under postprocessing we subsume the evils that happen after the week's
  558. data has been logged.  The processing modules of this section form a
  559. number of data pipelines applicable to different groups of objects.
  560.  
  561.   5.2.3.1 Input
  562. The input, the raw traffic log files from the NNStat logger, are byte
  563. and packet totals sampled cummulatively over each day for a series of
  564. "data objects".   We choose to generate weekly totals.   The records for
  565. a given object will be distributed over a number of files, a new file
  566. for each time the collect processes are restarted.
  567.  
  568. The objects we log can be divided into two groups.   Most are sampled at
  569. 30 minute intervals and checkpointed only at the 24h mark.   A smaller
  570. group are sampled at 5 minute intervals and checkpointed every 15
  571. minutes.   The latter are the IP logs used for generating total traffic
  572. figures for each target geographical destination, and containt subtotals
  573. for each subnet.
  574.  
  575. Below is a sample NNStat record for information coming into campus from
  576. Australian networks.   (Local subnet and subtotals have been
  577. overwritten for mystique).   The first figure after the subnet key is
  578. the number of packets, and the second figure the number of bytes.
  579. "Total Count" sums the packet information.
  580.  
  581. OBJECT: F.IN.dstsubn-all.from-ausnets.ip  Class= freq-all-bytes [Created: 00:00:34 11-21-93]
  582.   ReadTime: 00:00:00 11-22-93, ClearTime: 00:00:40 11-21-93 (@-86360sec)
  583.   Total Count= 649370 (+0 orphans)
  584.   Total Bytes= 48370339B    #bins = 43
  585. [128.250.aaa.0]= 999999 &99999999B   (75.6%) @-0sec
  586. [128.250.bbb.0]= 88888 &8888888B    ( 6.9%) @-17sec
  587. [128.250.ccc.0]= 77777 &7777777B    ( 4.9%) @-0sec
  588. [128.250.ddd.0]= 66666 &6666666B   ( 2.4%) @-0sec
  589. [128.250.eee.0]= 55555 &5555555B    ( 2.2%) @-11sec
  590. [128.250.fff.0]= 44444 &444444B     ( 1.8%) @-7sec
  591. ...
  592.  
  593.  
  594. The former, less frequently sampled group contain objects logging
  595. type-of-service details for TCP and UDP ports for each subnet.   Below
  596. is a sample recording TCP source-port details for traffic from
  597. Australian networks into campus.  (Local subnet and subtotals have been
  598. overwritten from boredom).
  599.  
  600.  
  601. OBJECT: S.IN.dstsubn.from-aus.tcp.srcports  Class= matrix-all-bytes  [Created: 0
  602. 0:00:34 11-21-93]
  603.   ReadTime: 00:00:00 11-22-93, ClearTime: 00:00:41 11-21-93 (@-86359sec)
  604.   Total Count= 412647 (+0 orphans)
  605.   Total Bytes= 25095824B    #bins = 45
  606. [119 "NNTP" : 128.250.aaa.0]= 999999 &99999999B  (90.8%) @-0sec
  607. [513 "rlogin|rwho" : 128.250.bbb.0]= 88888 &888888B ( 2.7%) @-21797sec
  608. [23 "Telnet" : 128.250.ccc.0]= 7777 &7777777B   ( 1.6%) @-21090sec
  609. [25 "SMTP" : 128.250.ddd.0]= 6666 &666666B       ( 1.2%) @-21sec
  610. [20 "FTP data" : 128.250.eee.0]= 5555 &5555555B    ( 1.0%) @-7766sec
  611. [20 "FTP data" : 128.250.fff.0]= 4444 &4444444B ( 1.0%) @-12179sec
  612. [79 "Finger" : 128.250.ggg.0]= 3333 &333333B   ( 0.4%) @-6410sec
  613. ...
  614.  
  615.  
  616.   5.2.3.2 Output
  617.  
  618. For each object we generate a single NNStat-style record sumarising the
  619. weeks traffic.
  620.  
  621.   5.2.3.3 Reconcilliation
  622.  
  623. As shown above, each NNStat record contains a header of summary info,
  624. and a table of values.   When ever our postprocessing modules read or
  625. write an NNStat record, they verify that the byte and packet totals in
  626. the header are still within a small percentage of the actual sums of
  627. the table.   (Anomalies are reported and can be detected by simple string
  628. searches of the postprocessing log.)   This simple reconcilliation
  629. procedure has detected a number of instances where corrupted data
  630. slipped past the initial log parsing.   However, it is probably not
  631. foolproof.   It would be safer if further reconcilliation phases were
  632. introduced within the pipeline.   A good target would be ensuring that
  633. the sum of IP traffic is not less than the sum of all TCP and UDP
  634. services.
  635.  
  636.   5.2.3.4 Geographic totals pipeline
  637.  
  638. Processing for simple sums of IP to and from of the geographic target
  639. areas are conceptually straightforward.
  640.  
  641. All the records relevant to a given object are collated and the
  642. effects of any restarts or clears between records are removed.   The
  643. last record is then the accumulation of the weeks data, so this record
  644. is extracted.   The results are sorted, with separate tables being
  645. produced for packet and byte measures.
  646.  
  647. This forms our basic pipeline.
  648.  
  649.   5.2.3.5 Type-of-Service totals pipeline
  650.  
  651. A number of extra modules must be inserted into the above unit to
  652. handle type-of-service data.   Information collected for source and
  653. destination ports must be combined.   Most protocols can be adequately
  654. handled in one of two ways, depending on whether they establish a
  655. connection with a well-known port number at one end (sum source and
  656. destination values) or both ends (take the maximum of source and
  657. destination values).   At this point we have possibly several entries
  658. for a single subnet, so we must sum matching subnet/port combinations.
  659. Various services use multiple ports, so we have another module to sum
  660. these.  Finally, TCP and UDP information is combined, and then the
  661. sorting modules are invoked.
  662.  
  663. --------------------------------------------------------------------------
  664.     7 Performance Considerations
  665.  
  666. On our platforms the NNStat processes appear to be CPU-limited.
  667. The figures below are from the production server, a DECstation 5000/250.
  668. They describe performance under the current config, which sets the
  669. resolution of local peer to be at the level of subnet.
  670.  
  671. The current config logs something over 30M of files per week.  The
  672. files produced by postprocessing are less than 2M.   This is composed
  673. of 541 objects checkpointed daily, and 144 objects checkpointed at
  674. 15 minute intervals.   The latter form more than 90% of the bulk.
  675. Any time-based accounting could substantially increase disk usage.
  676.  
  677. For the collect processes, size in virtual memory and the resident set
  678. size appears to be static and easily manageable.   CPU time is
  679. dependant on the number of objects and amount of information per
  680. object, but the total CPU time expended over a 24h period is quite
  681. modest.
  682.  
  683.    USER       PID %CPU %MEM   SZ  RSS TT STAT   TIME COMMAND
  684.     ray      27256  0.0  0.4 1188  200 ?  S      0:00 collect -m 644 ...
  685.     ray      27248  0.0  0.4 1188  220 ?  S      0:28 collect -m 644 ...
  686.     ray      27240  0.0  0.4 1188  220 ?  S      0:28 collect -m 644 ...
  687.     ray      27231  0.0  0.4 1188  216 ?  I      1:19 collect -m 644 ...
  688.  
  689. Of the above processes, the first is collecting information for one object.
  690. The middle two are each collecting information on 270 objects.   The lower
  691. one is collecting information on 144 objects polled at 5 minute intervals;
  692. the upper three are polling statspy at 30 minute intervals.
  693.  
  694.  
  695. The statspy process consumes appreciable CPU time, and expands
  696. gradually throughout the logging period.   Memory will probably not
  697. become a problem, given that we're restarting the process every 24h -
  698. the process size starts at less than 2M (the snapshot below is 60"
  699. after invocation):
  700.  
  701.    USER       PID %CPU %MEM   SZ  RSS TT STAT   TIME COMMAND
  702.    ray       7495  0.4  2.6 1952 1448 ?  S      0:11 statspy parm.noc
  703.  
  704. and on an average day grew to something over 2M:
  705.  
  706.    USER       PID %CPU %MEM   SZ  RSS TT STAT   TIME COMMAND
  707.    ray      27219  0.0  3.1 2252 1712 ?  S N  149:33 statspy parm.noc
  708.  
  709. However, it consumed some 9000 seconds of CPU time in the period.
  710. Process accounting has shown this to be the mode, but there are
  711. occaisional peaks of 25,000 seconds, which is a substantial portion of
  712. the 86,400 seconds of one day.  (It would be interesting to see what
  713. memory consumption had got to on those days, but we've only just
  714. started logging this.)
  715.  
  716. There's three things statspy might be spending CPU time on:  incrementing
  717. counters;  working out which counter to increment;   or downloading
  718. figures to the collect process.
  719.  
  720. We haven't observed a marked increase in statspy's CPU consumption
  721. during the periodic polls by the collect processes.  This implies that
  722. CPU usage is basically spent in processing traffic, and we presume
  723. dominated by the complexity of pattern matching encoded in the config.
  724. If this is the case then, at peak traffic loads, our current server
  725. probably won't cope with a substantially more complicated config.
  726.  
  727. We have been using the ULTRIX packet filter with the default maximum
  728. queue of 32 packets (NNStat automatically requests maximum queue
  729. length).   (We haven't checked what diagnostics we'd receive from either
  730. NNStat or the kernel in the event of an overflow, but will investigate
  731. this as soon as the development server is configured.)
  732.  
  733. As mooted in the initial discussion of our task (see section 1), subnet
  734. resolution may not be sufficient for some applications.   Converting
  735. the config from the subnet paradigm to a departmental paradigm - moving
  736. the peer resolution towards individual hosts - dramatically increases
  737. the complexity of the config, in the worst case by more than two orders
  738. of magnitude.   Clearly we can't ask CPU time to increase by this
  739. factor.  (Nor, for that matter, disk usage, but we can collate host
  740. info without logging it to file.)
  741.  
  742. It remains to be seen whether some intermediate solution is plausible.
  743. Answering this reliably requires determining the CPU cost factors of
  744. various formats of config.   Note that the actual CPU usage under any
  745. config depends on the profile and quantity of traffic.   If reliable
  746. estimates of CPU costs are determined, then the worst case traffic
  747. profiles and maximum traffic loads that a stats server will cope with
  748. can be predicted.   (Which could be put another way - that any stats
  749. server is only reliable up to a given load of traffic, and it would
  750. probably be useful to know what that load is  :)
  751.  
  752.  
  753. --------------------------------------------------------------------------
  754.     8    ancillary info
  755.  
  756.   8.1 time
  757.   8.2 system downtime
  758.   8.3 anomaly tagging
  759.   8.4 config version tagging
  760.  
  761. Here are things we should be doing but aren't, or are still developing.
  762.  
  763.   8.1 time
  764. A network stats server must have a reliable time source, particularly
  765. if the information collected is used to generate bills.   Installing the
  766. NTP suite is a suitable solution.
  767.  
  768.   8.2 system downtime
  769. What we miss is as important as what we get.   Every report must note
  770. server downtime, and where possible estimate the effect of this on
  771. recorded results.   Even merely registering downtime is a messy problem.
  772. We identify three components: downtime due to
  773.     platform failure (OS or hardware);
  774.     stats system failure (s/w error or resource privation)
  775.     interruptions in network connectivity.
  776. Each of these requires its own method of monitoring and logging.
  777.  
  778.   8.3 anomaly tagging
  779. There are a range of situations that are useful to keep in mind when
  780. viewing stats - eg, interruptions to logging, network storms, partial
  781. network failures, connection of new services, and changes in filtering
  782. policy.   This information tends not to be collated anywhere.   It is
  783. useful not only to log these events consistently, but to have some way
  784. of tagging potentially anomalous data with cross-references to the
  785. related events.
  786.  
  787.   8.4 config version tagging
  788. Unfortunately, different postprocessing functionality is sometimes
  789. required in different config versions.   Most simply, when new objects
  790. are logged, they must be processed.   Changes in the config must be
  791. logged.  For any project that will last longer than a few months it
  792. would be worth considering using the config version to tag the data,
  793. and enabling automatic selection of an appropriate postprocessing
  794. regime.
  795.  
  796. --------------------------------------------------------------------------
  797.     9    conclusions
  798.  
  799. Nothing is as simple as it seems.   Even given perfect network stats
  800. software, some ancilliary information is required.   As far as possible,
  801. inclusion of ancilliary information should be automated, as it
  802. is inordinately fiddly and time-consuming to collate manually.
  803.  
  804. It has proved to be practical to log type-of-service information at the
  805. resolution of the local subnet for a class B network with class C netmask.
  806.  
  807. Subnet-level resolution is probably insufficient for billing purposes,
  808. particularly if billing at a departmental level rather than faculty
  809. level.
  810.  
  811. It is not known whether increasing resolution to the level of local hosts
  812. is practical on the current server platform.   This can be investigated
  813. when the develpmental server is configured.
  814.  
  815. The primary restrictions on expanding the stats system are expected to
  816. be CPU time and disk space.
  817.